package com.abel.cloud.hystrix.controller;

import com.abel.cloud.common.po.UserAccountPO;
import com.abel.cloud.common.response.Resp;
import com.abel.cloud.hystrix.service.UserAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

    @Autowired
    private UserAccountService userAccountService;

    /**
     * Feign 模式调用服务
     * @param id
     * @return
     */
    @GetMapping("feign/user/{id}")
    public Resp<UserAccountPO> getFeignUser(@PathVariable Integer id){
        return userAccountService.getUser(id);
    }

    @GetMapping("feign/timeout/{sec}")
    public Resp timeOut(@PathVariable Integer sec){
        return userAccountService.timeOut(sec);
    }



}
